<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * 群发消息表
 */
class CreateWxMass extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wx_mass', function (Blueprint $table) {
            $table->increments('mass_id')->comment('群发消息ID');
            $table->string('msg_data_id', 30)->default('')->comment('消息的数据ID');
            $table->string('title', 150)->default('')->comment('消息标题');
            $table->mediumText('description')->comment('消息描述');
            $table->string('msg_type', 50)->default('')->comment('消息类型');
            $table->string('filter_type')->default('ALL')->comment('过滤类别');
            $table->unsignedInteger('filter_tag_id')->default(0)->comment('用户标签ID');
            $table->text('filter_touser')->nullable()->comment('接收者openId列表');
            $table->unsignedInteger('material_id')->default(0)->comment('素材表主键');
            $table->string('media_id', 150)->default('')->comment('永久素材ID');
            $table->string('card_id', 50)->default('')->comment('卡券');
            $table->unsignedTinyInteger('send_ignore_reprint')->default(1)->comment('图文消息被判定为转载时，是否继续群发');
            $table->unsignedInteger('errcode')->default(0)->comment('错误码');
            $table->string('errmsg', 50)->default('')->comment('错误信息');
            $table->unsignedInteger('msg_id')->default(0)->comment('消息发送任务的ID');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wx_mass');
    }
}
